from jinja2 import environment

'''
For Example:
    
def sex(value)
:
    if value == 1:
        return '男'
    else:
        return '女'
    
in your app:    
@route('/')
def index():
    return jinja2_template('index', {'sex': 1})   
    
    
in the template：
{{ sex| sex }}
'''


from global_conf.filter import *

# add some template constant
register_name_space = {
    'static': '123',
}
# register filters
register_filter = {
    'sex': sex,
}

environment.DEFAULT_NAMESPACE.update(register_name_space)
environment.DEFAULT_FILTERS.update(register_filter)